<template>
  <router-view />
</template>
<script setup>
import { watch } from "vue-demi";
import { useRoute } from "vue-router";
import store from "./store";

//添加不需要加标签导航的白名单
const whiteList = ["/login", "/", "/index"];
const route = useRoute();

//监听路由 实现url 绑定动态标签导航
watch(
  route,
  (to, from) => {
    if (whiteList.indexOf(to.path) === -1) {
      let tab = {
        name: to.name,
        path: to.path,
      };

      store.commit("ADD_TAB", tab);
    }
  },
  { deep: true, immediate: true }
);
</script>
<style>
html,
body,
#app {
  height: 100%;
}

.app-container {
  padding: 20px;
}
</style>
